﻿@model List<IdentityServer4.EntityFramework.Entities.Client>
@using IdentityServer4.EntityFramework.Mappers

@{
    ViewData["Title"] = "Clients";
}
<link href="~/css/showtip.css" rel="stylesheet" />
<style>
    table {
        table-layout: fixed;
        word-break: break-all;
    }
    hr{
        margin:6px;
    }
</style>
<div>
    <h2>@ViewData["Title"]</h2>
</div>
<hr />

<div class="row">
    <div class="col-md-12">
        <div>
            <div class="pull-left">
                <a asp-action="CreateOrEdit" asp-route-id="0" class="btn btn-primary">
                    <span title="Create New" class="glyphicon glyphicon-plus-sign"></span> Add New
                </a>
            </div>
        </div>
    </div>
</div>
<br />
<div class="">
    <table class="table table-striped">
        <thead>
            <tr>
                <th style="width:150px;">客户端Id</th>
                <th style="width:230px;">客户端名</th>
                <th style="width:180px;">授权类型</th>
                <th>作用域</th>
                <th>允许跨域</th>
                <th>回调地址</th>
                <th>退出回调</th>
                <th style="width:80px;">Operate</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                var clientModel = item.ToModel();
                <tr>
                    <td>
                        @Html.DisplayFor(modelItem => item.ClientId)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.ClientName)
                    </td>
                    <td>
                        @Html.Raw(string.Join("<br>", clientModel.AllowedGrantTypes))
                    </td>
                    <td>
                        @Html.Raw(string.Join("<br>", clientModel.AllowedScopes))
                    </td>
                    <td>
                        @Html.Raw(string.Join("<hr>", clientModel.AllowedCorsOrigins))
                    </td>
                    <td>
                        @Html.Raw(string.Join("<hr>", clientModel.RedirectUris))
                    </td>
                    <td>
                        @Html.Raw(string.Join("<hr>", clientModel.PostLogoutRedirectUris))
                    </td>
                    <td>
                        <a asp-action="CreateOrEdit" asp-route-id="@item.Id" title="Edit" class="btn btn-warning">
                            <span class="glyphicon glyphicon-pencil">Edit</span>
                        </a>

                    </td>
                </tr>
            }
        </tbody>
    </table>
</div>

